package com.neu.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.neu.dao.DengluDao;
import com.neu.entity.Users;
import com.neu.util.JDBCUtil;

public class DengluDaoImpl implements DengluDao {

	/**
	 *   登录的方法
	 */
	@Override
	public boolean Denglu(Users u) throws SQLException {
		Connection conn = null;
		try {
			conn = JDBCUtil.getConn();
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String sql = "select * from tb_users_role where name=? and pass=?";
		PreparedStatement ps = conn.prepareStatement(sql);
		ps.setString(1, u.getName());
		ps.setString(2, u.getPass());
		ResultSet rs = ps.executeQuery();
		while(rs.next()) {
			return true;
		}
		return false;
	}

}
